package com.trainoo.service;

import com.trainoo.repository.ChapterRepository;
import com.trainoo.domain.Chapter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by zhoutao on 2018/6/28 17:20
 */
@Service
public class ChapterService {

    private static Logger logger = LoggerFactory.getLogger(ChapterService.class);

    @Autowired
    private ChapterRepository repository;

    public void insert(Chapter chapter){
        try{
            repository.save(chapter);
        }catch (Exception e){
            logger.error("插入数据异常，chapter={}", chapter);
        }
    }
}
